﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.OleDb;
using System.Text;

namespace Contributor
{
    class DbLib
    {
        public static Int16 GetInt16(OleDbDataReader rdr, int index)
        {
            if (rdr[index] != DBNull.Value)
                return (Int16)rdr.GetInt16(index);
            else
                return 0;
        }

        public static Int32 GetInt32(OleDbDataReader rdr, int index)
        {
            if (rdr[index] != DBNull.Value)
                return (Int32)rdr.GetInt32(index);
            else
                return 0;
        }



        public static String GetString(OleDbDataReader rdr, int index)
        {
            if (rdr[index] != DBNull.Value)
                return rdr[index].ToString();
            else
                return null;
        }

        public static DateTime GetDateTime(OleDbDataReader rdr, int index)
        {
            if (rdr[index] != DBNull.Value)
                return rdr.GetDateTime(index);
            else
                return DateTime.MinValue;
        }


        public static bool GetBoolean(OleDbDataReader rdr, int index)
        {
            if (rdr[index] != DBNull.Value)
                return rdr.GetBoolean(index);
            else
                return false;
        }

    }
}
